package cn.stylefeng.guns.modular.business.frequency.orderpickfree.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.business.frequency.orderpickfree.service.OrderPickFreeService;
import cn.stylefeng.guns.modular.business.frequency.orderpickfree.model.param.OrderPickFreeParam;

import javax.annotation.Resource;

/**
 * 免费提短记录表 控制器
 *
 * @author: yujie
 * @date: 2023/05/09 17:16
 */
@RestController
public class OrderPickFreeController {

    @Resource
    private OrderPickFreeService orderPickFreeService;

    /**
     * 分页查询免费提短记录表
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderPickFree/page")
    @BusinessLog(title = "免费提短记录表_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(OrderPickFreeParam orderPickFreeParam) {
        return new SuccessResponseData(orderPickFreeService.page(orderPickFreeParam));
    }

    /**
     * 获取全部免费提短记录表
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderPickFree/list")
    @BusinessLog(title = "免费提短记录表_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(OrderPickFreeParam orderPickFreeParam) {
        return new SuccessResponseData(orderPickFreeService.list(orderPickFreeParam));
    }

    /**
     * 查看详情免费提短记录表
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderPickFree/detail")
    @BusinessLog(title = "免费提短记录表_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(OrderPickFreeParam.detail.class) OrderPickFreeParam orderPickFreeParam) {
        return new SuccessResponseData(orderPickFreeService.detail(orderPickFreeParam));
    }

    /**
     * 添加免费提短记录表
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderPickFree/add")
    @BusinessLog(title = "免费提短记录表_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(OrderPickFreeParam.add.class) OrderPickFreeParam orderPickFreeParam) {
        orderPickFreeService.add(orderPickFreeParam);
        return new SuccessResponseData();
    }

    /**
     * 删除免费提短记录表
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderPickFree/delete")
    @BusinessLog(title = "免费提短记录表_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(OrderPickFreeParam.delete.class) OrderPickFreeParam orderPickFreeParam) {
        orderPickFreeService.delete(orderPickFreeParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑免费提短记录表
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderPickFree/edit")
    @BusinessLog(title = "免费提短记录表_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(OrderPickFreeParam.edit.class) OrderPickFreeParam orderPickFreeParam) {
        orderPickFreeService.edit(orderPickFreeParam);
        return new SuccessResponseData();
    }


}
